package flc.ast.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyWordKindBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.bean.StkTagResBean;

public class MovieKindAdapter extends StkProviderMultiAdapter<StkTagResBean> {

    public MovieKindAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(25));
        addItemProvider(new WordKindProvider());
    }

    private class WordKindProvider extends BaseItemProvider<StkTagResBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_movie_kind;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, StkTagResBean bean) {
            baseViewHolder.setText(R.id.tvMovieKindItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setTextColor(R.id.tvMovieKindItemName, Color.parseColor("#FFFFFF"));
                baseViewHolder.setBackgroundResource(R.id.tvMovieKindItemName,R.drawable.shape_movie_kind);
            } else {
                baseViewHolder.setTextColor(R.id.tvMovieKindItemName, Color.parseColor("#FF081935"));
                baseViewHolder.setBackgroundResource(R.id.tvMovieKindItemName,0);
            }
        }
    }
}
